<?php

/**
 * VTNSCustomer form base class.
 *
 * @method VTNSCustomer getObject() Returns the current form's model object
 *
 * @package    vtns
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseVTNSCustomerForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'customer_id'     => new sfWidgetFormInputHidden(),
      'order_id'        => new sfWidgetFormInputText(),
      'full_name'       => new sfWidgetFormInputText(),
      'gender'          => new sfWidgetFormInputText(),
      'date_birth'      => new sfWidgetFormDateTime(),
      'passport_number' => new sfWidgetFormInputText(),
      'passport_expire' => new sfWidgetFormDateTime(),
      'nationality'     => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'customer_id'     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('customer_id')), 'empty_value' => $this->getObject()->get('customer_id'), 'required' => false)),
      'order_id'        => new sfValidatorInteger(array('required' => false)),
      'full_name'       => new sfValidatorString(array('max_length' => 8, 'required' => false)),
      'gender'          => new sfValidatorInteger(array('required' => false)),
      'date_birth'      => new sfValidatorDateTime(array('required' => false)),
      'passport_number' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'passport_expire' => new sfValidatorDateTime(array('required' => false)),
      'nationality'     => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('vtns_customer[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'VTNSCustomer';
  }

}
